﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ServerLib
{
    /// <summary>
    /// Delegete for chat server wich to work with send messages
    /// </summary>
    /// <param name="sender">object</param>
    /// <param name="e">object for send messages</param>
    public delegate void ChatEventHandler(Object sender, ChatEventArgs e);

    /// <summary>
    /// Class for send Messages
    /// </summary>
    [Serializable]
    public class ChatEventArgs : EventArgs
    {
        private String _login;
        private String _message;

        public String Login { get { return _login; } }
        public String Message { get { return _message; } }

        public ChatEventArgs(String login, String message)
        {
            _login = login;
            _message = message;
        }
    }

    /// <summary>
    /// Callback class for act on client
    /// </summary>
    public class RemotelyDelegatableObject : MarshalByRefObject
    {
        public RemotelyDelegatableObject()
            : base()
        { }
        public void SubmissionCallback(object sender, ChatEventArgs e)
        {
            InternalSubmissionCallback(sender, e);
        }

        /// <summary>
        /// Method for used some act
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void InternalSubmissionCallback(object sender, ChatEventArgs e)
        {
            Console.WriteLine("Work Delegate ChatEventArgs...");
        }
    }
}
